package cn.gzmli.dtt.common.workflow.controller;

import cn.gzmli.dtt.common.annotation.Comment;
import cn.gzmli.dtt.common.entity.PageInfo;
import cn.gzmli.dtt.common.entity.Result;
import cn.gzmli.dtt.common.utils.Constant;
import cn.gzmli.dtt.common.workflow.service.WorkProgressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @Descript
 * @Author xsx
 * @Date 2018/1/23
 */
@Controller
@RequestMapping("/workProgress")
public class WorkProgressController {
    @Autowired
    private WorkProgressService workProgressService;

    @RequestMapping("/listWorkProgress")
    @ResponseBody
    @Comment("获取业务进度列表")
    public Result listWorkProgress(String workFlowID, Integer bID, Integer order, PageInfo pageInfo) throws Exception {
        List<Map<String, Object>> data = this.workProgressService.getWorkProgress(workFlowID, bID, order, pageInfo);
        return new Result(Constant.SUCCESS, "获取业务进度列表成功", data, pageInfo);
    }

    @RequestMapping("/listWorkFlowLogs")
    @ResponseBody
    @Comment("获取业务流程操作记录列表")
    public Result listWorkFlowLogs(HttpServletRequest request, PageInfo pageInfo) throws Exception {
        List<Map<String, Object>> data = this.workProgressService.getWorkFlowLogs(request, pageInfo);
        return new Result(Constant.SUCCESS, "获取业务流程操作记录列表成功", data, pageInfo);
    }
}
